/*     */ package com.openbravo.pos.forms;
/*     */ 
/*     */ import aaaCasher.casherForm;
import aaaTimer.BoxMod;

import com.attilax.io.filex;
import com.attilax.io.pathx;
import com.attilax.orders.OrderReportForm;
import com.attilax.ui.HTML5Form;
import com.openbravo.basic.BasicException;
/*     */ import com.openbravo.beans.RoundedBorder;
/*     */ import com.openbravo.data.gui.JMessageDialog;
/*     */ import com.openbravo.data.gui.MessageInf;
/*     */ import com.openbravo.pos.scripting.ScriptEngine;
/*     */ import com.openbravo.pos.scripting.ScriptException;
/*     */ import com.openbravo.pos.scripting.ScriptFactory;
/*     */ import com.openbravo.pos.util.Hashcypher;
/*     */ import com.openbravo.pos.util.StringUtils;

/*     */ import java.awt.BorderLayout;
/*     */ import java.awt.CardLayout;
/*     */ import java.awt.Color;
/*     */ import java.awt.Component;
/*     */ import java.awt.ComponentOrientation;
/*     */ import java.awt.Font;
/*     */ import java.awt.Insets;
/*     */ import java.awt.Rectangle;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.io.IOException;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import java.util.logging.Level;
/*     */ import java.util.logging.Logger;

/*     */ import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
/*     */ import javax.swing.Action;
/*     */ import javax.swing.BorderFactory;
/*     */ import javax.swing.Box;
/*     */ import javax.swing.BoxLayout;
/*     */ import javax.swing.Icon;
/*     */ import javax.swing.ImageIcon;
/*     */ import javax.swing.JButton;
/*     */ import javax.swing.JComponent;
/*     */ import javax.swing.JLabel;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JScrollPane;

import org.eclipse.swt.widgets.Display;
/*     */ import org.jdesktop.swingx.JXTaskPane;
/*     */ import org.jdesktop.swingx.JXTaskPaneContainer;
/*     */ 
/*     */ public class JPrincipalApp extends JPanel
/*     */   implements AppUserView
/*     */ {
/*  51 */   private static Logger logger = Logger.getLogger("com.openbravo.pos.forms.JPrincipalApp");
/*     */   private JRootApp m_appview;
/*     */   private AppUser m_appuser;
/*     */   private DataLogicSystem m_dlSystem;
/*     */   private JLabel m_principalnotificator;
/*     */   private JPanelView m_jLastView;
/*     */   private Action m_actionfirst;
/*     */   private Map<String, JPanelView> m_aPreparedViews;
/*     */   private Map<String, JPanelView> m_aCreatedViews;
/*     */   private Icon menu_open;
/*     */   private Icon menu_close;
/*     */   private JButton jButton1;
/*     */   private JPanel jPanel1;
/*     */   private JPanel jPanel2;
/*     */   private JPanel m_jPanelContainer;
/*     */   private JScrollPane m_jPanelLeft;
/*     */   private JPanel m_jPanelRight;
/*     */   private JPanel m_jPanelTitle;
/*     */   private JLabel m_jTitle;
/*     */ 
	/*     */public JPrincipalApp(JRootApp appview, AppUser appuser)
	/*     */{
		/* 72 */this.m_appview = appview;
		/* 73 */this.m_appuser = appuser;
		/*     */
		/* 75 */this.m_dlSystem = ((DataLogicSystem) this.m_appview
				.getBean("com.openbravo.pos.forms.DataLogicSystem"));
		/*     */
		/* 78 */
		//ati for use mysql
					//this.m_appuser.fillPermissions(this.m_dlSystem);
		/*     */
		/* 80 */this.m_actionfirst = null;
		/* 81 */this.m_jLastView = null;
		/* 82 */this.m_aPreparedViews = new HashMap();
		/* 83 */this.m_aCreatedViews = new HashMap();
		/*     */
		/* 85 */initComponents();
		/*     */
		/* 87 */this.jPanel2.add(Box.createVerticalStrut(50), 0);
		/*     */
		/* 89 */applyComponentOrientation(appview.getComponentOrientation());
		/*     */
		/* 91 */this.m_principalnotificator = new JLabel();
		/* 92 */this.m_principalnotificator
				.applyComponentOrientation(getComponentOrientation());
		/* 93 */this.m_principalnotificator.setText(this.m_appuser.getName());
		/* 94 */this.m_principalnotificator.setIcon(this.m_appuser.getIcon());
		/*     */
		/* 97 */if (this.jButton1.getComponentOrientation().isLeftToRight()) {
			/* 98 */this.menu_open = new ImageIcon(getClass().getResource(
					"/com/openbravo/images/menu-right.png"));
			/* 99 */this.menu_close = new ImageIcon(getClass().getResource(
					"/com/openbravo/images/menu-left.png"));
			/*     */} else {
			/* 101 */this.menu_open = new ImageIcon(getClass().getResource(
					"/com/openbravo/images/menu-left.png"));
			/* 102 */this.menu_close = new ImageIcon(getClass().getResource(
					"/com/openbravo/images/menu-right.png"));
			/*     */}
		/* 104 */assignMenuButtonIcon();
		/*     */
		/* 107 */this.m_jPanelTitle.setBorder(RoundedBorder
				.createGradientBorder());
		/* 108 */this.m_jPanelTitle.setVisible(true);// ati to true
		m_jPanelTitle.setToolTipText("aaaaaaaaa");
		/*     */
		/* 111 */this.m_jPanelContainer.add(new JPanel(), "<NULL>");
		/* 112 */showView("<NULL>");
		/*     */try
		/*     */{
			//ati tmp 
		//	menu_ati();
			/**
			 * resourceAsText=== group = menu.addGroup("Menu.Main");
			 * group.addPanel("/com/openbravo/images/mycomputer.png",
			 * "Menu.Ticket", "com.openbravo.pos.sales.JPanelTicketSales");
			 * group.addPanel("/com/openbravo/images/mycomputer.png",
			 * "Menu.TicketEdit", "com.openbravo.pos.sales.JPanelTicketEdits");
			 * group.addPanel("/com/openbravo/images/kdmconfig.png",
			 * "Menu.CustomersPayment",
			 * "com.openbravo.pos.customers.CustomersPayment");
			 * group.addPanel("/com/openbravo/images/mycomputer.png",
			 * "Menu.Payments", "com.openbravo.pos.panels.JPanelPayments");
			 * group.addPanel("/com/openbravo/images/mycomputer.png",
			 * "Menu.CloseTPV", "com.openbravo.pos.panels.JPanelCloseMoney");
			 * group.addPanel("/com/openbravo/images/appointment.png",
			 * "Menu.Closing", "/com/openbravo/reports/closedpos.bs");
			 */
			/* 116 */String resourceAsText = filex.read(pathx.webAppPath()+"/print_templates/"+"Menu.Root"+".txt");
					//D:\workspace 空格\AtiBrow\print_templates\Menu.Root.txt
//					this.m_dlSystem
//					.getResourceAsText("Menu.Root");

			// org.jdesktop.swingx.JXTaskPaneContainer
			Component scriptMenu = getScriptMenu(resourceAsText);
			m_jPanelLeft.setToolTipText("left panel tips");
			
			
			menu_boxMode(scriptMenu);
			this.m_jPanelLeft.setViewportView(scriptMenu);
			
			
			
			
			/*     */} catch (ScriptException e) {
							//////////--------------start
						/* 118 */logger.log(Level.SEVERE,
							"Cannot read Menu.Root resource. Trying defaut menu.", e);
							try {
					/* 120 */this.m_jPanelLeft
							.setViewportView(getScriptMenu(StringUtils
									.readResource("/com/openbravo/pos/templates/Menu.Root.txt")));
					/*     */} catch (IOException ex) {
					/* 122 */logger.log(Level.SEVERE, "Cannot read default menu",
							ex);
					/*     */} catch (ScriptException es) {
					/* 124 */logger.log(Level.SEVERE, "Cannot read default menu",
							es);
					/*     */}
					//////////--------------start end
			
			/*     */}   /////end catch
		
		
	//	menu_ati();
	
		/*     */}

	private void menu_boxMode(Component scriptMenu__JXTaskPaneContainer) {
	// TODO Auto-generated method stub
		JXTaskPaneContainer c=(JXTaskPaneContainer) scriptMenu__JXTaskPaneContainer;
		
		 JXTaskPane details = new JXTaskPane();
		 details.setTitle("JXTaskPane ati");
		 
		 JButton searchLabel = new JButton("包厢模块");
		 searchLabel.setFocusable(false);
		 details.add(searchLabel);
		 
//		 JButton searchLabel2 = new JButton("btn2");
//		 details.add(searchLabel2);
		 
		 searchLabel.addActionListener(new ActionListener() {
	            @Override
	            public void actionPerformed(ActionEvent e) {
	            	 Runnable runnable_4form = new Runnable() {  
	         	        public void run() {  
	         	        	final BoxMod ef=new BoxMod();
	         	    		ef.show();
	         	    		ef.atiBrowserExampleinstance.browser.refresh();
	         	    		ef.forceActive();
	         	        }  
	         	    };
	         	   // runnable_4form.run();
	         	 Display.getDefault().syncExec(runnable_4form);  
	            }
	        });
		 
		 
		 JButton btn_charege=	 new JButton("用户帐户充值");
		 btn_charege.setFocusable(false);
		 btn_charege.addActionListener(new ActionListener() {
	            @Override
	            public void actionPerformed(ActionEvent e) {
	            	 Runnable runnable_4form = new Runnable() {  
	         	        public void run() {  
	         	       	String h=pathx.classPathParent_jensyegeor()+"/dbmanag/list.html?db=wxmiqi&table=ecs_users&dbg=0";
	         			HTML5Form fm=new HTML5Form(h);
	         			fm.setSize(960, 550);
	         			fm.show();
	         			fm.forceActive();
	         	        }  
	         	    };
	         	   // runnable_4form.run();
	         	 Display.getDefault().syncExec(runnable_4form);  
	            }
	        });
		 details.add(btn_charege);
		 
 JButton jButton_count = new JButton("收银单统计");
 jButton_count.setFocusable(false);

 
 jButton_count.addActionListener(new ActionListener() {
		            @Override
		            public void actionPerformed(ActionEvent e) {
		            	 Runnable runnable_4form = new Runnable() {  
		         	        public void run() {  
		         	      
		         	        	OrderReportForm fm =new OrderReportForm();
		         			fm.show();
		         			fm.forceActive();
		         			
		         	        }  
		         	    };
		         	   // runnable_4form.run();
		         	 Display.getDefault().syncExec(runnable_4form);  
		            }
		        });
		 
 details.add(jButton_count);
		
		 
		final JButton jButton_dbmana = new JButton("数据库表统计");
		jButton_dbmana.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				Runnable runnable_4form = new Runnable() {
					public void run() {
						String h = pathx.classPathParent_jensyegeor()
								+ "/dbmanag/schema_list.html?table=ecs_users&dbg=1";
						HTML5Form fm = new HTML5Form(h);
						fm.setSize(960, 550);
						fm.show();

						fm.forceActive();

						jButton_dbmana.setFocusable(false);
					}
				};
				// runnable_4form.run();
				Display.getDefault().syncExec(runnable_4form);
			}
		});
				 
 
details.add(jButton_dbmana);

c.add(details);
	
}

	private void menu_ati() {
		
		 ScriptMenu menu = new ScriptMenu();

		// org.jdesktop.swingx.JXTaskPaneContainer
		 
	ScriptGroup	 group = menu.addGroup("Menu.Main");
		    group.addPanel("/com/openbravo/images/mycomputer.png", "Menu.Ticket", "com.openbravo.pos.sales.JPanelTicketSales");
		    group.addPanel("/com/openbravo/images/mycomputer.png", "Menu.TicketEdit", "com.openbravo.pos.sales.JPanelTicketEdits");
		    group.addPanel("/com/openbravo/images/kdmconfig.png", "Menu.CustomersPayment", "com.openbravo.pos.customers.CustomersPayment");
		    group.addPanel("/com/openbravo/images/mycomputer.png", "Menu.Payments", "com.openbravo.pos.panels.JPanelPayments");
		    group.addPanel("/com/openbravo/images/mycomputer.png", "Menu.CloseTPV", "com.openbravo.pos.panels.JPanelCloseMoney");
		    group.addPanel("/com/openbravo/images/appointment.png", "Menu.Closing", "/com/openbravo/reports/closedpos.bs");
 	Component scriptMenu = menu.getTaskPane();
		m_jPanelLeft.setToolTipText("left panel tips");
		this.m_jPanelLeft.setViewportView(scriptMenu);
		
	

			//ret  JXTaskPaneContainer
/* 136 */   //  return menu.getTaskPane();
}

	/*     */

/*     */   private Component getScriptMenu(String menutext) throws ScriptException
/*     */   {
/* 131 */     ScriptMenu menu = new ScriptMenu();
/*     */ 
/* 133 */     ScriptEngine eng = ScriptFactory.getScriptEngine("beanshell");
/* 134 */     eng.put("menu", menu);
/* 135 */     Object eval = eng.eval(menutext);

				//ret  JXTaskPaneContainer
/* 136 */     return menu.getTaskPane();
/*     */   }
/*     */ 
/*     */   private void assignMenuButtonIcon() {
/* 140 */     this.jButton1.setIcon(this.m_jPanelLeft.isVisible() ? this.menu_close : this.menu_open);
/*     */   }
/*     */ 
/*     */   private void setMenuVisible(boolean value)
/*     */   {
/* 259 */     this.m_jPanelLeft.setVisible(value);
/* 260 */     assignMenuButtonIcon();
/* 261 */     revalidate();
/*     */   }
/*     */ 
/*     */   public JComponent getNotificator() {
/* 265 */     return this.m_principalnotificator;
/*     */   }
/*     */ 
/*     */   public void activate()
/*     */   {
/* 270 */     setMenuVisible(getBounds().width > 800);
/*     */ 
/* 273 */     if (this.m_actionfirst != null) {
/* 274 */       this.m_actionfirst.actionPerformed(null);
/* 275 */       this.m_actionfirst = null;
/*     */     }
/*     */   }
/*     */ 
/*     */   public boolean deactivate() {
/* 280 */     if (this.m_jLastView == null)
/* 281 */       return true;
/* 282 */     if (this.m_jLastView.deactivate()) {
/* 283 */       this.m_jLastView = null;
/* 284 */       showView("<NULL>");
/* 285 */       return true;
/*     */     }
/* 287 */     return false;
/*     */   }
/*     */ 
/*     */   private void showView(String sView)
/*     */   {
/* 329 */     CardLayout cl = (CardLayout)(CardLayout)this.m_jPanelContainer.getLayout();
/* 330 */     cl.show(this.m_jPanelContainer, sView);
/*     */   }
/*     */ 
/*     */   public AppUser getUser() {
/* 334 */     return this.m_appuser;
/*     */   }
/*     */ 
/*     */   public void showTask(String sTaskClass)
/*     */   {
/* 339 */     this.m_appview.waitCursorBegin();
/*     */ //ati this.m_appuser.hasPermission(sTaskClass)
/* 341 */     if ("a".equals("a"))
/*     */     {
	//com.openbravo.pos.inventory.ProductsPanel==m_jLastView
/* 343 */       JPanelView m_jMyView = (JPanelView)this.m_aCreatedViews.get(sTaskClass);
m_jMyView=null;// ati for new create everyone
/*     */ 
/* 346 */       if ((this.m_jLastView == null) || ((m_jMyView != this.m_jLastView) )) //ati q15 for mysql del   (this.m_jLastView.deactivate())
/*     */       {
/* 349 */         if (m_jMyView == null)
/*     */         {
/* 352 */           m_jMyView = (JPanelView)this.m_aPreparedViews.get(sTaskClass);
/* 353 */           if (m_jMyView == null) {
/*     */             try
/*     */             {
/* 356 */               m_jMyView = (JPanelView)this.m_appview.getBean(sTaskClass);
/*     */             } catch (BeanFactoryException e) {
/* 358 */               m_jMyView = new JPanelNull(this.m_appview, e);
/*     */             }
/*     */           }
/*     */ 
/* 362 */           m_jMyView.getComponent().applyComponentOrientation(getComponentOrientation());
/* 363 */           this.m_jPanelContainer.add(m_jMyView.getComponent(), sTaskClass);
/* 364 */           this.m_aCreatedViews.put(sTaskClass, m_jMyView);
/*     */         }
/*     */ 
/*     */         try
/*     */         {
	//mem menu  ==com.openbravo.pos.forms.JPanelMenu>>com.openbravo.pos.customers.CustomersPanel
	//com.openbravo.pos.sales.JPanelTicketSales
/* 369 */           m_jMyView.activate();
/*     */         } catch (BasicException e) {
	e.printStackTrace();
	//AppLocal.getIntString("message.notactive")
/* 371 */           JMessageDialog.showMessage(this, new MessageInf(-33554432," message.notactive q15" , e));
/*     */         }
/*     */ 
/* 375 */         this.m_jLastView = m_jMyView;
/*     */ 
/* 377 */       //  setMenuVisible(getBounds().width > 800);
/*     */ setMenuVisible(true);
/* 379 */         showView(sTaskClass);
/*     */ 
/* 381 */         String sTitle = m_jMyView.getTitle();
/* 382 */       //  this.m_jPanelTitle.setVisible(sTitle != null);
this.m_jPanelTitle.setVisible(true);  //ati
/* 383 */         this.m_jTitle.setText(sTitle);
/*     */       }
/*     */     }
/*     */     else {
/* 387 */       JMessageDialog.showMessage(this, new MessageInf(-33554432, AppLocal.getIntString("message.notpermissions")));
/*     */     }
/* 389 */     this.m_appview.waitCursorEnd();
/*     */   }
/*     */ 
/*     */   public void executeTask(String sTaskClass)
/*     */   {
/* 394 */     this.m_appview.waitCursorBegin();
/*     */ 
/* 396 */     if (this.m_appuser.hasPermission(sTaskClass)) {
/*     */       try {
/* 398 */         ProcessAction myProcess = (ProcessAction)this.m_appview.getBean(sTaskClass);
/*     */         try
/*     */         {
/* 402 */           MessageInf m = myProcess.execute();
/* 403 */           if (m != null)
/*     */           {
/* 405 */             JMessageDialog.showMessage(this, m);
/*     */           }
/*     */         }
/*     */         catch (BasicException eb) {
/* 409 */           JMessageDialog.showMessage(this, new MessageInf(eb));
/*     */         }
/*     */       } catch (BeanFactoryException e) {
/* 412 */         JMessageDialog.showMessage(this, new MessageInf(-33554432, AppLocal.getIntString("Label.LoadError"), e));
/*     */       }
/*     */     }
/*     */     else {
/* 416 */       JMessageDialog.showMessage(this, new MessageInf(-33554432, AppLocal.getIntString("message.notpermissions")));
/*     */     }
/* 418 */     this.m_appview.waitCursorEnd();
/*     */   }
/*     */ 
/*     */   private void initComponents()
/*     */   {
/* 429 */     this.jPanel1 = new JPanel();
/* 430 */     this.jPanel2 = new JPanel();
/* 431 */     this.jButton1 = new JButton();
/* 432 */     this.m_jPanelLeft = new JScrollPane();
/* 433 */     this.m_jPanelRight = new JPanel();
/* 434 */     this.m_jPanelTitle = new JPanel();
/* 435 */     this.m_jTitle = new JLabel();
/* 436 */     this.m_jPanelContainer = new JPanel();
/*     */ 
/* 438 */     setLayout(new BorderLayout());
/*     */ 
/* 440 */     this.jPanel1.setLayout(new BorderLayout());
/*     */ 
/* 442 */     this.jPanel2.setLayout(new BoxLayout(this.jPanel2, 1));
/*     */ 
/* 444 */     this.jButton1.setFocusPainted(false);
/* 445 */     this.jButton1.setFocusable(false);
/* 446 */     this.jButton1.setMargin(new Insets(14, 2, 14, 2));
/* 447 */     this.jButton1.setRequestFocusEnabled(false);
/* 448 */     this.jButton1.addActionListener(new ActionListener() {
/*     */       public void actionPerformed(ActionEvent evt) {
/* 450 */         JPrincipalApp.this.jButton1ActionPerformed(evt);
/*     */       }
/*     */     });
/* 453 */     this.jPanel2.add(this.jButton1);
/*     */ 
/* 455 */     this.jPanel1.add(this.jPanel2, "After");
/* 456 */     this.jPanel1.add(this.m_jPanelLeft, "Center");
/*     */ 
/* 458 */     add(this.jPanel1, "Before");
/*     */ 
/* 460 */     this.m_jPanelRight.setLayout(new BorderLayout());
/*     */ 
/* 462 */     this.m_jPanelTitle.setLayout(new BorderLayout());
/*     */ 
/* 464 */     this.m_jTitle.setFont(new Font("SansSerif", 1, 18));
/* 465 */     this.m_jTitle.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.darkGray), BorderFactory.createEmptyBorder(10, 10, 10, 10)));
/* 466 */     this.m_jPanelTitle.add(this.m_jTitle, "North");
/*     */ 
/* 468 */     this.m_jPanelRight.add(this.m_jPanelTitle, "North");
/*     */ 
/* 470 */     this.m_jPanelContainer.setLayout(new CardLayout());
/* 471 */     this.m_jPanelRight.add(this.m_jPanelContainer, "Center");
/*     */ 
/* 473 */     add(this.m_jPanelRight, "Center");
/*     */   }
/*     */ 
/*     */   private void jButton1ActionPerformed(ActionEvent evt)
/*     */   {
/* 478 */     setMenuVisible(!this.m_jPanelLeft.isVisible());
	//setMenuVisible(true);// true;
/*     */   }
/*     */ 
/*     */   private class ChangePasswordAction extends AbstractAction
/*     */   {
/*     */     public ChangePasswordAction(String icon, String keytext)
/*     */     {
/* 308 */       putValue("SmallIcon", new ImageIcon(JPrincipalApp.class.getResource(icon)));
/* 309 */       putValue("Name", AppLocal.getIntString(keytext));
/* 310 */       putValue("taskname", keytext);
/*     */     }
/*     */ 
/*     */     public void actionPerformed(ActionEvent evt)
/*     */     {
/* 315 */       String sNewPassword = Hashcypher.changePassword(JPrincipalApp.this, JPrincipalApp.this.m_appuser.getPassword());
/* 316 */       if (sNewPassword != null)
/*     */         try
/*     */         {
	//ati
/* 319 */         //  JPrincipalApp.this.m_dlSystem.execChangePassword(new Object[] { sNewPassword, JPrincipalApp.access$500(JPrincipalApp.this).getId() });
/* 320 */           JPrincipalApp.this.m_appuser.setPassword(sNewPassword);
/*     */         } catch ( Exception e) {
/* 322 */           JMessageDialog.showMessage(JPrincipalApp.this, new MessageInf(-33554432, AppLocal.getIntString("message.cannotchangepassword")));
/*     */         }
/*     */     }
/*     */   }
/*     */ 
/*     */   private class ExitAction extends AbstractAction
/*     */   {
/*     */     public ExitAction(String icon, String keytext)
/*     */     {
/* 295 */       putValue("SmallIcon", new ImageIcon(JPrincipalApp.class.getResource(icon)));
/* 296 */       putValue("Name", AppLocal.getIntString(keytext));
/* 297 */       putValue("taskname", keytext);
/*     */     }
/*     */     public void actionPerformed(ActionEvent evt) {
/* 300 */       JPrincipalApp.this.m_appview.closeAppView();
/*     */     }
/*     */   }
/*     */ 
/*     */   public class ScriptSubmenu
/*     */   {
/*     */     private MenuDefinition menudef;
/*     */ 
/*     */     private ScriptSubmenu(String key)
/*     */     {
/* 227 */       this.menudef = new MenuDefinition(key);
/*     */     }
/*     */ 
/*     */     public void addTitle(String key) {
/* 231 */       this.menudef.addMenuTitle(key);
/*     */     }
/*     */ 
/*     */     public void addPanel(String icon, String key, String classname) {
/* 235 */       this.menudef.addMenuItem(new MenuPanelAction(JPrincipalApp.this.m_appview, icon, key, classname));
/*     */     }
/*     */     public void addExecution(String icon, String key, String classname) {
/* 238 */       this.menudef.addMenuItem(new MenuExecAction(JPrincipalApp.this.m_appview, icon, key, classname));
/*     */     }
/*     */     public ScriptSubmenu addSubmenu(String icon, String key, String classname) {
/* 241 */       ScriptSubmenu submenu = new ScriptSubmenu(  key);
/* 242 */       JPrincipalApp.this.m_aPreparedViews.put(classname, new JPanelMenu(submenu.getMenuDefinition()));
/* 243 */       this.menudef.addMenuItem(new MenuPanelAction(JPrincipalApp.this.m_appview, icon, key, classname));
/* 244 */       return submenu;
/*     */     }
/*     */     public void addChangePasswordAction() {
/* 247 */       this.menudef.addMenuItem(new JPrincipalApp.ChangePasswordAction(  "/com/openbravo/images/yast_security.png", "Menu.ChangePassword"));
/*     */     }
/*     */     public void addExitAction() {
/* 250 */       this.menudef.addMenuItem(new JPrincipalApp.ExitAction(  "/com/openbravo/images/gohome.png", "Menu.Exit"));
/*     */     }
/*     */     public MenuDefinition getMenuDefinition() {
/* 253 */       return this.menudef;
/*     */     }
/*     */   }
/*     */ 
/*     */   public class ScriptGroup
/*     */   {
/*     */     private JXTaskPane taskGroup___JXTaskPane;
/*     */ 
/*     */     private ScriptGroup(String key)
/*     */     {
/* 173 */       this.taskGroup___JXTaskPane = new JXTaskPane();
/* 174 */       this.taskGroup___JXTaskPane.applyComponentOrientation(JPrincipalApp.this.getComponentOrientation());
/* 175 */       this.taskGroup___JXTaskPane.setFocusable(false);
/* 176 */       this.taskGroup___JXTaskPane.setRequestFocusEnabled(false);
/* 177 */       String intString = AppLocal.getIntString(key);//主菜单 main menu,jutsaide   //主管manager jugwe
					this.taskGroup___JXTaskPane.setTitle(intString);
/* 178 */       this.taskGroup___JXTaskPane.setVisible(true);//ati change to true ori is false;
/*     */     }
/*     */ 
/*     */     public void addPanel(String icon, String key, String classname) {
/* 182 */       MenuPanelAction act = new MenuPanelAction(JPrincipalApp.this.m_appview, icon, key, classname);
				addAction(act);
/*     */     }
/*     */     public void addExecution(String icon, String key, String classname) {
/* 185 */       addAction(new MenuExecAction(JPrincipalApp.this.m_appview, icon, key, classname));
/*     */     }
/*     */     public JPrincipalApp.ScriptSubmenu addSubmenu(String icon, String key, String classname) {
/* 188 */       JPrincipalApp.ScriptSubmenu submenu = new JPrincipalApp.ScriptSubmenu(  key );
/* 189 */       JPrincipalApp.this.m_aPreparedViews.put(classname, new JPanelMenu(submenu.getMenuDefinition()));
/* 190 */       addAction(new MenuPanelAction(JPrincipalApp.this.m_appview, icon, key, classname));
/* 191 */       return submenu;
/*     */     }
/*     */     public void addChangePasswordAction() {
/* 194 */       addAction(new JPrincipalApp.ChangePasswordAction(  "/com/openbravo/images/yast_security.png", "Menu.ChangePassword"));
/*     */     }
/*     */     public void addExitAction() {
/* 197 */       addAction(new JPrincipalApp.ExitAction(  "/com/openbravo/images/gohome.png", "Menu.Exit"));
/*     */     }




//private void addAction(Action act) {
//	if (m_appuser.hasPermission((String) act.getValue("taskname"))) {
//		Component c = taskGroup.add(act);
//		c.applyComponentOrientation(getComponentOrientation());
//		c.setFocusable(false);
//		taskGroup.setVisible(true);
//		if (m_actionfirst == null)
//			m_actionfirst = act;
//	}
//}


/*     */ //com.openbravo.pos.forms.MenuPanelAction@16ce961
/*     */     private void addAction(Action act)
/*     */     {
	System.out.println("--");
	//com.openbravo.pos.sales.JPanelTicketSales
/* 202 */       String value = (String)act.getValue("taskname");
//ati JPrincipalApp.this.m_appuser.hasPermission(value)
//ati add menu
				if ("a".equals("a"))
/*     */       {
/* 204 */         Component c = this.taskGroup___JXTaskPane.add(act);
/* 205 */         c.applyComponentOrientation(JPrincipalApp.this.getComponentOrientation());
/* 206 */         c.setFocusable(false);
/*     */ 
/* 209 */         this.taskGroup___JXTaskPane.setVisible(true);
/*     */ 
/* 211 */         if (JPrincipalApp.this.m_actionfirst == null)
/* 212 */            	m_actionfirst = act;
/*     */       }
/*     */     }
/*     */ 
/*     */     public JXTaskPane getTaskGroup()
/*     */     {
/* 219 */       return this.taskGroup___JXTaskPane;
/*     */     }
/*     */   }
/*     */ 
/*     */   public class ScriptMenu
/*     */   {
/*     */     private JXTaskPaneContainer taskPane;
/*     */ 
/*     */     private ScriptMenu()
/*     */     {
/* 150 */       this.taskPane = new JXTaskPaneContainer();
/* 151 */       this.taskPane.applyComponentOrientation(getComponentOrientation());
/*     */     }
/*     */ 
/*     */     public JPrincipalApp.ScriptGroup addGroup(String key)
/*     */     {
				//
/* 156 */       JPrincipalApp.ScriptGroup group = new JPrincipalApp.ScriptGroup( key);
/* 157 */       JXTaskPane taskGroup_taskPanel = group.getTaskGroup();
this.taskPane.add(taskGroup_taskPanel);
/* 158 */       return group;
/*     */     }
/*     */ 
/*     */     public JXTaskPaneContainer getTaskPane()
/*     */     {
/* 163 */       return this.taskPane;
/*     */     }
/*     */   }
/*     */
 
  }

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.forms.JPrincipalApp
 * JD-Core Version:    0.6.0
 */